* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00f7ff;
    --secondary-color: #0066ff;
    --accent-color: #ff00ff;
    --bg-color: #0a0a1a;
    --card-bg: rgba(16, 16, 32, 0.8);
    --border-glow: 0 0 10px var(--primary-color);
}

html, body {
    height: 90vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-color);
    font-family: 'Orbitron', sans-serif;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding: 20px;
    gap: 20px;
    background: linear-gradient(135deg, rgba(10, 10, 26, 0.9), rgba(20, 20, 40, 0.9));
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid var(--primary-color);
    box-shadow: var(--border-glow);
}

.player-area, .opponent-area {
    border: 2px solid var(--primary-color);
    padding: 15px;
    border-radius: 10px;
    flex: 1;
    position: relative;
    overflow: hidden;
    box-shadow: var(--border-glow);
}

.player-area::before, .opponent-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(0, 247, 255, 0.1) 50%, transparent 100%),
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 247, 255, 0.1) 10px, rgba(0, 247, 255, 0.1) 20px);
    pointer-events: none;
    animation: scan 3s linear infinite;
}

.opponent-area {
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.1), rgba(0, 102, 255, 0.1));
}

.player-area {
    background: linear-gradient(135deg, rgba(0, 247, 255, 0.1), rgba(0, 102, 255, 0.1));
}

.main-panel {
    display: flex;
    gap: 20px;
    flex: 1;
    margin-top: 10px;
}

.left-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
}

.right-panel {
    flex: 2;
    border-left: 2px dashed var(--primary-color);
    padding-left: 20px;
    position: relative;
}

.right-panel::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary-color);
    box-shadow: var(--border-glow);
}

.hand {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
    min-height: 150px;
    align-items: center;
    border: 1px dashed var(--primary-color);
    padding: 10px;
    background: var(--card-bg);
    box-shadow: var(--border-glow);
}

.hand:empty::before {
    content: "暂无手牌";
    color: var(--primary-color);
    font-size: 14px;
    width: 100%;
    text-align: center;
    text-shadow: 0 0 5px var(--primary-color);
}

.cards {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.card {
    width: 100px;
    height: 140px;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    position: relative;
    margin: 5px;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: var(--border-glow);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px var(--primary-color);
}

.info-panel {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
    font-size: 1.2em;
}

.controls {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

button {
    padding: 8px 20px;
    cursor: pointer;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    border-radius: 5px;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--primary-color);
}

.battle-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 160px;
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    padding: 10px;
    margin-top: 10px;
    background: var(--card-bg);
    box-shadow: var(--border-glow);
    position: relative;
    overflow: hidden;
}

.battle-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(0, 247, 255, 0.1) 50%, transparent 100%),
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 247, 255, 0.1) 10px, rgba(0, 247, 255, 0.1) 20px);
    pointer-events: none;
    animation: scan 3s linear infinite;
}

.timer {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
    font-size: 1.2em;
}

.bond-panel {
    min-height: 28px;
    margin: 8px 0 4px 0;
    font-size: 16px;
    color: var(--accent-color);
    font-weight: bold;
    letter-spacing: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    text-shadow: 0 0 5px var(--accent-color);
}

.bond-item {
    background: rgba(255, 0, 255, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    padding: 2px 10px;
    color: var(--accent-color);
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 0 10px var(--accent-color);
}

.bonds {
    min-height: 28px;
    margin: 8px 0 4px 0;
    font-size: 16px;
    color: var(--accent-color);
    font-weight: bold;
    letter-spacing: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    text-shadow: 0 0 5px var(--accent-color);
}

.merged-card {
    --merge-count: 0;
    animation: glow calc(1s + var(--merge-count) * 0.5s) ease-in-out infinite;
    box-shadow: 0 0 calc(20px + var(--merge-count) * 10px) var(--accent-color);
    transform: scale(calc(1.05 + var(--merge-count) * 0.05));
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.merged-card::after {
    content: '';
    position: absolute;
    top: calc(-5px - var(--merge-count) * 2px);
    left: calc(-5px - var(--merge-count) * 2px);
    right: calc(-5px - var(--merge-count) * 2px);
    bottom: calc(-5px - var(--merge-count) * 2px);
    background: radial-gradient(circle, 
        rgba(255, 0, 255, calc(0.3 + var(--merge-count) * 0.1)) 0%, 
        rgba(255, 0, 255, 0) calc(70% + var(--merge-count) * 5%));
    border-radius: calc(8px + var(--merge-count) * 2px);
    z-index: -1;
    animation: pulse calc(1s + var(--merge-count) * 0.5s) ease-in-out infinite;
}

@keyframes glow {
    0% {
        box-shadow: 0 0 calc(10px + var(--merge-count) * 5px) var(--accent-color);
        transform: scale(calc(1.05 + var(--merge-count) * 0.05));
    }
    50% {
        box-shadow: 0 0 calc(40px + var(--merge-count) * 20px) var(--accent-color);
        transform: scale(calc(1.1 + var(--merge-count) * 0.05));
    }
    100% {
        box-shadow: 0 0 calc(10px + var(--merge-count) * 5px) var(--accent-color);
        transform: scale(calc(1.05 + var(--merge-count) * 0.05));
    }
}

@keyframes pulse {
    0% {
        opacity: calc(0.5 + var(--merge-count) * 0.1);
        transform: scale(1);
    }
    50% {
        opacity: calc(0.8 + var(--merge-count) * 0.1);
        transform: scale(calc(1.1 + var(--merge-count) * 0.05));
    }
    100% {
        opacity: calc(0.5 + var(--merge-count) * 0.1);
        transform: scale(1);
    }
}

@keyframes scan {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 100% 100%;
    }
}

/* 基本样式 */
body {
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

/* 房间系统样式 */
.room-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.room-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

#room-info {
    margin-bottom: 20px;
}

#room-info p {
    margin: 10px 0;
    font-size: 16px;
}

#room-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#room-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

#room-actions button:hover {
    background-color: #45a049;
}

/* 游戏容器样式 */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 玩家信息样式 */
.player-info {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.player-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    font-size: 18px;
}

/* 战斗区域样式 */
.battle-area {
    display: flex;
    gap: 10px;
    min-height: 150px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* 手牌区域样式 */
.hand-area {
    display: flex;
    gap: 10px;
    min-height: 120px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 5px;
}

/* 游戏控制区域样式 */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: white;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.timer, .round {
    font-size: 18px;
    font-weight: bold;
}

#refresh-cards, #upgrade {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

#refresh-cards:hover, #upgrade:hover {
    background-color: #45a049;
}

/* 可用卡牌区域样式 */
.available-cards {
    display: flex;
    gap: 10px;
    padding: 15px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 卡牌样式 */
.card {
    width: 100px;
    height: 150px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
    transition: transform 0.3s;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 合成特效 */
.merged-card {
    animation: mergeEffect 1s ease-in-out;
}

@keyframes mergeEffect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .player-stats {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .card {
        width: 80px;
        height: 120px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .room-container {
        margin: 10px;
        padding: 20px;
    }
    
    .room-input {
        flex-direction: column;
        gap: 10px;
    }
    
    #room-actions {
        flex-direction: column;
        gap: 10px;
    }
}

/* 房间选择样式 */
.room-selection {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.room-input {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.room-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.room-input button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

.room-input button:hover {
    background-color: #45a049;
}

#create-room {
    padding: 15px 30px;
    font-size: 18px;
    background-color: #2196F3;
}

#create-room:hover {
    background-color: #1976D2;
}

/* 改进的卡牌样式 */
.card {
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(0, 247, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

/* 改进的按钮样式 */
button {
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

/* 改进的动画效果 */
@keyframes title-glow {
    0% {
        text-shadow: 0 0 15px #00f7ff;
    }
    100% {
        text-shadow: 0 0 25px #ff00ff, 0 0 35px #00f7ff;
    }
}

/* 改进的扫描动画 */
@keyframes scan {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 100% 100%;
    }
}